
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title><?php echo $title;?></title>
    <!-- 设置缩放 -->
    <meta name="viewport" content="minimal-ui,width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <!-- IOS中禁用将数字识别为电话号码/忽略Android平台中对邮箱地址的识别 -->
    <meta name="format-detection" content="telephone=no" />
    <!-- windows phone 点击无高光 -->
    <meta name="msapplication-tap-highlight" content="no" />
    <!-- icon -->
    <link rel="shortcut icon" href="<?php echo ADMIN_ICO_PIC;?>" type="image/x-icon"/>
    <!-- css -->
    <link rel="stylesheet" type="text/css" href="<?php echo SYS_LINK;?>admin/css/content.css?v=<?php echo V_CSSJS;?>" />

    <style>

    </style>
</head>

<body>
    <div class="con_box">
        <div class="lab_box2" style="max-width:1200px;min-width:1050px">
            <?php
            $urlList = SYS_URL_PATH('admin_mould');
            $urlNavleftAdd = SYS_URL_PATH("admin_mould_add");
            echo '<a href="'.$urlList.'" class="lab_base2 act">模型列表<i class="lab_act2"></i></a>'.PHP_EOL;
            echo '<a href="javascript:;" class="lab_base2 mould_add_btn" data-url="'.$urlNavleftAdd.'">+添加模型</a>'.PHP_EOL;
            ?>
        </div>
        <table class="table_th_td" style="max-width:1200px;min-width:1050px">
            <tr class="weight400">
                <th width="50">排序</th>
                <th width="60">ID</th>
                <th>模型名称</th>
                <th width="100">模型编码</th>
                <th width="80">模型类型</th>
                <th width="80">多菜单</th>
                <th width="80">详情模版</th>
                <th width="80">模型状态</th>
                <th width="80">字段管理</th>
                <th width="150">操作</th>
            </tr>
            <?php
            if(isset($list) && is_array($list)){
            foreach($list as $v){
                $id = $v['id'];
                $viewseq = $v['viewseq'];
                $mouldname = $v['mouldname'];
                $mouldcode = $v['mouldcode'];
                $mouldtypetxt = $v['mouldtypetxt'];
                $classflagtxt = $v['classflagtxt'];
                $tmplflagtxt = $v['tmplflagtxt'];
                $statustxt = $v['statustxt'];
                $mouldtypeS = $v['mouldtype'] == 1 ? 'style="display:none"' : '';
                $classflagC = $v['classflag'] == 2 ? 'statusHide' : '';
                $tmplflagC = $v['tmplflag'] == 2 ? 'statusHide' : '';
                $statusC = $v['status'] == 2 ? 'statusClose' : ($v['status'] == 3 ? 'statusHide' : '');
                $fieldUrl = SYS_URL_PATH("admin_field_index/mouldcode/$mouldcode/sortflag/2/tableid/1");
                $updateUrl = SYS_URL_PATH("admin_mould_update/id/$id");
                $delUrl = SYS_URL_PATH("admin_mould_del/id/$id");
                echo <<<html
            <tr>
                <td class="center"><input type="text" class="viewseq" data-id="$id" value="$viewseq"></td>
                <td class="center">$id</td>
                <td class="other_btn" data-url="$updateUrl" title="$mouldname">$mouldname</td>
                <td>$mouldcode</td>
                <td class="center">$mouldtypetxt</td>
                <td class="center $classflagC">$classflagtxt</td>
                <td class="center $tmplflagC">$tmplflagtxt</td>
                <td class="center $statusC">$statustxt</td>
                <td class="center">
                    <a href="javascript:;" data-url="$fieldUrl" class="btn_base btn_line_none btn_field_main" >字段管理</a>
                </td>
                <td class="center">
                    <a href="javascript:;" data-url="$updateUrl" class="btn_base btn_line_none btn_mould_up" $mouldtypeS>编辑</a>
                    <a href="javascript:;" data-url="$delUrl" class="btn_base btn_line_none btn_mould_del" $mouldtypeS>删除</a>
                </td>
            </tr>
html;

            }
            }
            ?>
            <tr class="operates_box">
                <td class="center" >
                    <button class="btn_base btn_height20 btn_line_none" id="viewseq_btn" title="提交排序"
                            data-url="<?php echo SYS_URL_PATH('admin_mould_seq')?>">↓↑</button>
                </td>
                <td colspan="9"></td>
            </tr>
        </table>
    </div>
</body>
<script language="javascript">
    var cssjsv = '<?php echo V_CSSJS;?>';
    var http_url = '<?php echo SYS_HOST;?>';
    var http_link = '<?php echo SYS_LINK;?>';
    var http_fix = '<?php echo SYS_URL_FIX;?>';
</script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/jquery.min.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/skin.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/common.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript">file_load('list');</script>
<script language="javascript">

    // 加载完毕后
    window.onload = function () {

    }

    //添加/修改模型-弹层页面
    $('.mould_add_btn,.btn_mould_up').click(function(){
        layerIframeOpen($(this).attr('data-url'), '750px', '460px', 1);
    });

    //字段管理-弹层页面
    $('.btn_field_main').click(function(){
        layerIframeOpen($(this).attr('data-url'), '90%', '90%', 1);
    });

    //删除
    var flagSub = true;
    $('.btn_mould_del').click(function(){
        let goutoURL = $(this).attr('data-url');
        if(!goutoURL){
            layer.msg('网络异常');return false;
        }
        layer.confirm('确定删除？会删除对应的表结构', {
            btn: ['确定','取消']
        }, function(){
            if(!flagSub){
                layer.msg('处理中……(禁止重复提交)');return false;
            }
            flagSub = false;
            $.post(goutoURL, {subFlag:'Y'}, function(data){
                flagSub = true;
                if(data=='Y'){
                    layer.msg('删除成功');
                    setTimeout(function(){
                        window.location.reload();
                    },2500);
                }else{
                    layer.msg('操作失败_'+data);
                }
            },'json').error(function(){
                flagSub = true;
                layer.msg('网络异常');
            });
        }, function(){ });
    })

</script>
</html>